#include "InputManager.h"
#include <iostream>

#include "includes.h"
#ifdef WINDOWS
	//VERY VERY WINDOWS / DOS SPECIFIC!!!!
	#include <conio.h>
#else
	//VERY VERY *NIX SPECIFIC!!!!
	//Thanks to those on forums for this sample code. don't remember exactly where?
	#include <stdio.h>
	#include <termios.h>
	#include <unistd.h>

	int mygetch ( void ) 
	{
		int ch;
		struct termios oldt, newt;

		tcgetattr ( STDIN_FILENO, &oldt );
		newt = oldt;
		newt.c_lflag &= ~( ICANON | ECHO );
		tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
		ch = getchar();
		tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );

		return ch;
	}


#endif


CInputManager::CInputManager()
{
}

CInputManager::~CInputManager()
{
}


char CInputManager::getInput()
{
	#ifdef WINDOWS
		event = getch();
	#else
		event = (char)mygetch();
	#endif
	//if you really want to go for support uncomment these and comment above
	//event = std::cin.get();
	//std::cin >> event;
	return event;
}
